package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import com.alibaba.fastjson.JSON;
import lombok.*;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
//游记推荐
public class DestinationComment extends BaseDomain {

    public static final int HOT_COMMEND = 1;
    public static final int NORMAL_COMMEND = 0;
    //关联目的地
    private Destination dest;
    //关联目的地主题
    private DestinationTheme theme;
    //推荐封面
    private String coverUrl;
    //推荐的月份
    private Integer month;
    //推荐的天数
    private Integer days;
    //推荐的状态
    private Integer state = NORMAL_COMMEND;
    //序号
    private Integer sequence = 0;

    public String getJsonString() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        if (dest != null) {
            map.put("destName", dest.getName());
            map.put("destId", dest.getId());
        }
        if (theme != null) {
            map.put("themeName", theme.getName());
            map.put("themeId", theme.getId());
            map.put("themeType", theme.getType());
        }
        map.put("coverUrl", coverUrl);
        map.put("month", month);
        map.put("days", days);
        map.put("state", state);
        map.put("sequence", sequence);
        return JSON.toJSONString(map);
    }




}